package com.dz51.core.validate;

import org.springframework.context.ApplicationContext;
import org.springframework.web.servlet.DispatcherServlet;

import com.dz51.core.validate.context.UrlMethodValidateMapping;

public class MyValidateDispatcherServlet extends DispatcherServlet {

	private static final long serialVersionUID = 1L;
	private String basePackagePath = "";

	public String getBasePackagePath() {
		return basePackagePath;
	}

	public void setBasePackagePath(String basePackagePath) {
		this.basePackagePath = basePackagePath;
	}

	@Override
	protected void initStrategies(ApplicationContext context) {
		super.initStrategies(context);
		System.out.println("[参数校验器 --- 开始建立校验规则]");
		if (logger.isDebugEnabled()) {
			logger.debug("[参数校验器 --- 开始建立校验规则]");
		}
		UrlMethodValidateMapping.getInstance().initMappingRules(this.getBasePackagePath());
		System.out.println("[参数校验器 --- 建立校验规则完成]");
		if (logger.isDebugEnabled()) {
			logger.debug("[参数校验器 --- 建立校验规则完成]");
		}
	}

}
